package com.hbnu.commonclass;

/**
 * @author kittychen
 * @date 2025-09-23 11:07
 */
public class StringTest {

    public static void main(String[] args) {
        String str1 = "abc";
        String str2 = new String("abc");
        String str3 = "abc";
        System.out.println(str1 == str2);
        System.out.println(str1.equals(str2));

        String content = " hfhaohfoawfnm,afawheof oagjpaewpfaf! ";
        System.out.println(content.length());
        System.out.println(content.indexOf("a"));
        System.out.println(content.lastIndexOf("a"));
        System.out.println(content.substring(3));
        System.out.println(content.substring(3, 10));   // 包含头，不包含尾
        System.out.println(content.trim());  // 去除字符串前后空格
        System.out.println(content.toUpperCase());
        String[] split = content.split(",");
        for (String s : split) {
            System.out.println(s);
        }

    }
}
